# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-humanfriendly
pkgname=('python2-humanfriendly' 'python-humanfriendly')
_pkgname=humanfriendly
pkgver=10.0
pkgrel=5
pkgdesc='Human friendly output for text interfaces using Python.'
arch=('any')
url='https://pypi.org/project/humanfriendly/#files'
license=('MIT')
options=(!emptydirs)
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('496700bcea1dabf003c938558bf807fabb41b71192f69622979dd9e243dda9b4b06c5ac8f65cef217df85ebadf99099dc22b50d63216791a569be11081d267d6')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-humanfriendly() {
  depends=('python2' 'python2-monotonic')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/humanfriendly" "$pkgdir/usr/bin/humanfriendly2"
}

package_python-humanfriendly() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

